package org.geoscrape;

import java.io.Serializable;

/**
 * 
 * A waypoint that forms part of a cache.
 * 
 * This is usually a parking area, a step in a multicache, a trailhead, or
 * similar.
 * 
 */
public class WayPoint extends BasePlace implements Serializable
{
	private static final long serialVersionUID = 1476745457841494363L;
	private Cache partOf;
	private String lookup;
	private String prefix;
	private String type;

	/**
	 * Set the cache this waypoint is part of
	 * 
	 * @param partOf
	 */
	public void setPartOf(Cache partOf)
	{
		this.partOf = partOf;
	}

	/**
	 * Get the cache this waypoint is part of.
	 * 
	 * @return
	 */
	public Cache getPartOf()
	{
		return partOf;
	}

	/**
	 * @return the lookup
	 */
	public String getLookup()
	{
		return lookup;
	}

	/**
	 * @param lookup
	 *            the lookup to set
	 */
	public void setLookup(String lookup)
	{
		this.lookup = lookup;
	}

	/**
	 * @return the prefix
	 */
	public String getPrefix()
	{
		return prefix;
	}

	/**
	 * @param prefix
	 *            the prefix to set
	 */
	public void setPrefix(String prefix)
	{
		this.prefix = prefix;
	}

	/**
	 * This is the name used in .gpx files for waypoints
	 */
	public String getWaypointCode()
	{
		String cacheCode = this.partOf.getCacheCode();
		// strip leading chars
		cacheCode = cacheCode.substring(2);
		return getPrefix() + cacheCode;
	}

	/**
	 * @param type
	 */
	public void setType(String type)
	{
		this.type = type;
	}

	public String getType()
	{
		return this.type;
	}
}
